home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
COMAL
/
B-Book Series
/
(k)b2.d64
/
oddeven
< prev
next >
Wrap
Text File
|
2007-02-28
|
1KB
|
46 lines
0010 //* ODD OR EVEN *//
0020 //
0030 //PREPARE TO PLAY//
0040 PRINT "NOW WE ARE GOING TO PLAY 'ODD OR EVEN'"
0050 PRINT
0060 PRINT "HOW MANY GAMES DO YOU LIKE TO PLAY",
0070 INPUT NUMBER
0080 PRINT
0090 PRINT "OK, HERE WE GO."
0100 PRINT "IF YOUR GUESS IS 'ODD' THEN TYPE 1,"
0110 PRINT "BUT IF YOUR GUESS IS 'EVEN' THEN TYPE 0."
0120 PRINT
0130 COUNTWIN:=0
0140 //---------------//
0150 FOR I:=1 TO NUMBER DO
0160 //-GUESSING-//
0170 PRINT "WHAT IS YOUR GUESS (1,0)",
0180 INPUT GUESS
0190 OUTCOME:=RND(0,1)
0200 PRINT
0210 //-DISPLAY RESULT-//
0220 IF OUTCOME=0 THEN
0230 PRINT "THE RESULT WAS EVEN."
0240 ELSE
0250 PRINT "THE RESULT WAS ODD."
0260 ENDIF
0270 //-ANNOUNCE WINNER-//
0280 IF GUESS=OUTCOME THEN
0290 PRINT "CONGRATULATIONS, YOU WIN."
0300 COUNTWIN:=COUNTWIN+1
0310 ELSE
0320 PRINT "SORRY, YOU HAVE LOST."
0330 ENDIF
0340 PRINT
0350 PRINT "HERE IS ANOTHER ROUND:"
0360 ENDFOR I
0370 //---------------//
0380 //-GAME IS OVER-//
0390 PRINT
0400 PRINT "THANK'S FOR THE GAME"
0410 PRINT "YOU HAVE WON ",COUNTWIN," ROUND(S),"
0420 PRINT "AND I HAVE WON ",NUMBER-COUNTWIN," ROUND(S)."
0430 PRINT
0440 PRINT "GOODBYE."
0450 //---------------//